#ifndef __LCD_DEV_H__
#define __LCD_DEV_H__

#include "esp_err.h"
#include "device.h"
#include "../lcd/st7789.h"

#ifdef __cplusplus
extern "C" {
#endif

struct lcd_device_api {
    int (*set_brightness)(struct device* dev, int brightness);
    void (*set_color)(struct device* dev, uint16_t color);
    void (*draw_pictrue)(struct device* dev, int x_start, int y_start, int x_end, int y_end, const unsigned char *gImage);
};

static inline int lcd_set_brightness(struct device* dev, int brightness)
{
    const struct lcd_device_api *api = dev->driver_api;

    return api->set_brightness(dev, brightness);
}

static inline void lcd_set_color(struct device* dev, uint16_t color)
{
    const struct lcd_device_api *api = dev->driver_api;

    api->set_color(dev, color);
}

static inline void lcd_draw_pictrue(struct device* dev, int x_start, int y_start, int x_end, int y_end, const unsigned char *gImage)
{
    const struct lcd_device_api *api = dev->driver_api;

    api->draw_pictrue(dev, x_start, y_start, x_end, y_end, gImage);
}

#ifdef __cplusplus
}
#endif

#endif /* __LCD_DEV_H__ */